<template>
  <div>
    <el-container>
     <div class="h-father">
        <div class="header-top">
        <div class="header">
          <div class="top_nav_content">
            <div
              class="demonstration demoleft"
              @mouseover="show('hover1')"
              @mouseout="hidden('hover1')"
            >
              <span>全球集团官网</span>
              <i class="el-icon-caret-bottom" v-show="!hover1"></i>
              <i class="el-icon-caret-top" v-show="hover1"></i>
            </div>
            <div class="demoright-f">
              <div
                class="demonstration demoright"
                @mouseover="show('hover2')"
                @mouseout="hidden('hover2')"
              >
                <span>快捷入口</span>
                <i class="el-icon-caret-bottom" v-show="!hover2"></i>
                <i class="el-icon-caret-top" v-show="hover2"></i>
              </div>
              <div class="nav-line">|</div>
              <div class="nav-language">
                <a href="">中</a>
                <a href="">EN</a>
              </div>
            </div>
            
          </div>
        </div>

        <div
          class="menu-left"
          v-show="hover1"
          @mouseover="show('hover1')"
          @mouseout="hidden('hover1')"
        >
          <div
            v-for="(item, index) in navs.left"
            :key="index"
            class="menu-left-2"
          >
            <p class="p-title">{{ item.titleLeft }}</p>
            <ul v-for="(child, i) in item.contentLeft" :key="i">
              <li @click="$router.push({ path: child.route })">
                {{ child.titleLeft }}
              </li>
            </ul>
          </div>
        </div>

        <div
          class="menu-right"
          v-show="hover2"
          @mouseover="show('hover2')"
          @mouseout="hidden('hover2')"
        >
          <div
            v-for="(item, index) in navs.right"
            :key="index"
            class="menu-right-2"
          >
            <p class="p-title">{{ item.titleRight }}</p>
            <ul v-for="(child, i) in item.contentRight" :key="i">
              <li>{{ child.titleRight }}</li>
            </ul>
          </div>
        </div>

        <div class="header_nav_bottom">
          <div :class="{ header_nav_bottom_one: true, bg: ahover }">
            <div class="header_nav_bottom_one_content">
              <div :class="{ h_n_b_o_meun_Haier: ahover }">
                <h1>Haier</h1>
              </div>
              <div class="header_nav_bottom_one_content_menu">
                <div
                  v-for="(item, index) in navs.navBottom"
                  :key="index"
                  class="h_n_b_o_meun_center"
                  @mouseover="show('hover3')"
                  @mouseout="hidden('hover3')"
                >
                  <a
                    href=""
                    @mouseover="show('ahover')"
                    @mouseout="hidden('ahover')"
                    ><p>{{ item.navBottomTitle }}</p></a
                  >
                </div>
              </div>
              <div class="h_n_b_o_serach">
                <input
                  type="text"
                  placeholder="搜索关键词"
                  style="border: none"
                />
                <i class="el-icon-search"></i>
              </div>
            </div>
            <div
              v-show="hover3"
              @mouseover="show('hover3')"
              @mouseout="hidden('hover3')"
            >
              <cmenu></cmenu>
            </div>
          </div>
        </div>
      </div>
     </div>
      
      <el-main>
        <div class="mian_body-one">
          <div
            class="swiper-slide"
            v-for="(item, index) in images"
            v-show="index === mark"
            :key="index"
          >
            <img
              @mouseover="stop(stophov)"
              @mouseout="play()"
              :src="item"
              alt=""
              width="100%"
            />
          </div>
          <ul class="page">
            <li
              v-for="(circle, i) in images"
              :key="i"
              @click="gotoPage(i)"
              :class="{ current: mark == i }"
            ></li>
          </ul>
          </div>
          <div class="mian_body-two">
            <div><a href=""><h1>我们的品牌</h1></a></div>
            <div><a href=""><p>我们携手全球一流生态合作方，持续构建衣食住行康养医教等物联网生态圈，为全球用户定制个性化的智慧生活。</p></a></div>
            <el-carousel :interval="4000" type="card" height="200px">
              <el-carousel-item v-for="(item,index) in images2" :key="index">
                <img class="medium" :src="item" alt="" width="1149px" height="504px">
              </el-carousel-item>
            </el-carousel>
          </div>
      </el-main>
      <el-footer>Footer</el-footer>
    </el-container>
  </div>
</template>

<script>
import haiernav from "@/assets/haiernav.json";
import menulist from "@/components/menu";
export default {
  data() {
    return {
      hover1: false,
      hover2: false,
      hover3: false,
      ahover: false,
      stophov: true,
      navs: haiernav,
      timer: null,
      images: [
        // require("@/public/images/tag-2/b01.jpg"),
        // require("@/public/images/tag-2/b02.jpg"),
        // require("@/public/images/tag-2/b03.jpg"),
      ],
      images2:[
        // require("@/public/images/tag-2/c01.png"),
        // require("@/public/images/tag-2/c02.png"),
        // require("@/public/images/tag-2/c03.png"), 
      ],
      mark: 0, //图片轮播的索引
    };
  },

  methods: {
    show(type) {
      this[type] = true;
    },
    hidden(type) {
      this[type] = false;
    },
    autoplay() {
      this.mark++;
      if (this.mark === 3) {
        this.mark = 0;
      }
    },
    gotoPage(i) {
      this.mark = i;
    },
    play() {
      this.timer = setInterval(this.autoplay, 3000);
    },
    stop(stophov) {
      if (stophov == true) {
        clearInterval(this.timer);
      }
    },
  },
  created() {
    this.play();
  },
  components: {
    'cmenu': menulist,
  },
};
</script>

<style scoped>
* {
  margin: 0;
  padding: 0;
  list-style-type: none;
  text-decoration: none;
}

h1:hover{
  cursor: pointer;
}
.h-father{
  position: relative;
}
.header *{
  display: inline-block;
  
}

.header :first-child > h1{
  position: relative;
  padding-right: 30px;
  color: #004ea1;
  bottom: -5px;
}

.header > :last-child{
  position: relative;
  left: 10%;
}

.header-top {
  height: 40px;
  display: inline-block;
  width: 100%;
  position: relative;
}

.header {
  position: relative;
  width: 100%;
  background-color: rgb(15, 35, 65);
}

.top_nav_content {
  width: 80%;
}

.demoleft:hover {
  cursor: pointer;
}
.demoright-f {
  float: right;
}

.demonstration i {
  color: aliceblue;
}

.demonstration > span {
  line-height: 40px;
  color: aliceblue;
  font-size: 14px;
}
.nav-line {
  color: #fff;
  width: 0.5em;
  padding: 0 20px;
}

.nav-language a {
  color: #fff;
  font-size: 14px;
  padding: 0 10px;
}

.p-title {
  font-size: 13px;
  color: inherit;
  opacity: 0.45;
  padding-top: 25px;
  padding-bottom: 15px;
}
.menu-left {
  height: 400px;
  width: 100%;
  background-color: rgb(15, 35, 65);
  position: absolute;
  z-index: 10;
}

.menu-left-2 {
  height: 100px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  width: 80%;
  margin-left: 10%;
  color: gray;
}

.menu-left-2 > ul li {
  float: left;
  margin-right: 30px;
  color: aliceblue;
}

.menu-right {
  height: 420px;
  width: 350px;
  background-color: rgb(15, 35, 65);
  position: absolute;
  right: 15%;
  z-index: 10;
}
.menu-right-2 {
  height: 80px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-left: 30px;
  color: gray;
  /* box-sizing: border-box; */
}
.menu-right-2 > ul li {
  font-size: 11px;
  float: left;
  color: aliceblue;
  border-right: 1px solid rgba(255, 255, 255, 0.274);
  padding: 0 10px;
}
.header_nav_bottom {
  display: inline-block;

  width: 100%;
}
.header_nav_bottom_one {

  background: rgba(36, 33, 33, 0.075);
  float: left;
  width: 100%;
  color: white;
}
.h_n_b_o_meun_Haier {
  color: #005aaa;
}

.bg {
  background: #fff;
  color: #005aaa;
}
.header_nav_bottom_one_content {
  width: 85%;
  height: 80px;
  margin: 0 150px;
 
}
.header_nav_bottom_one_content div {
  display: inline-block;
  line-height: 80px;

}
.header_nav_bottom_one_content_menu {
  margin-left: 300px;
}
.h_n_b_o_meun_center {
  width: 140px;
  text-align: center;
}
.h_n_b_o_meun_center > a {
  font-style: inherit;
  font-size: 20px;
  color: inherit;
  /* color: rgb(255, 251, 251); */
}
.h_n_b_o_meun_center > a:hover {
  cursor: pointer;
  font-weight: bold;
  color: rgb(12, 31, 128);
}

.h_n_b_o_serach {
  width: 150px;
  height: 40px;
  border: 1px solid #fff;
  margin-left: 200px;
}
.h_n_b_o_serach > input {
  border: none;
  outline: 0;
  width: 90px;
  font-size: 14px;
  background: 0 0;
  margin: 0;
  color: black;
}
.el-main{
  padding: 0;
  position: relative;
  z-index: -10;
  top: -80px;
}
.mian_body-one{
  height: 944px;
  width: 100%;
 
}
.mian_body-two{
  height: 794px;
}
.swiper-slide{
  position: absolute;
  height: 944px;
}
.page {
  position: absolute;
  right: 701.5px;
  top: 99%;
  text-align: center;
  width: 500px;
}
.page li {
  margin: auto 5px;
  display: inline-block;
  background: gray;
  border-radius: 50%;
  width: 10px;
  height: 10px;
}
.current {
  border: solid 1px snow;
}
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}


/* -------------- */



</style>